<div class="yiiForm">

<?php


if(Yii::app()->user->hasFlash('model')) {
	Yii::app()->user->flash('model', array('<div class="confirmation">', '</div>'));
	echo "</div>";
	return;
}

$JFV=Yii::app()->jformvalidate;
$JFV->setOptions(array(
		'errorElement'=> 'div',
		'errorClass' => 'invalid',
        ));


echo $JFV->form(); 
?>

	<p class="note">Fields with <span class="required">*</span> are required.</p>

	<?php echo Html::errorSummary($model); ?>

	<div class="simple">
		<?php echo Html::activeLabel($model,'title'); ?>
		<?php echo $JFV->activeTextField($model,'title'); ?>
	</div>

	<div class="simple">
		<?php echo Html::activeLabel($model,'code'); ?>
		<?php echo $JFV->activeTextArea($model,'code',array('style'=>'height:300px')); ?>
	</div>
	<div class="simple">
		<?php echo EHtml::activeLabel($model,'category'); ?>
		<?php echo Html::activeDropDownList($model,'category',
		array(
		'1'=>Yii::t('yii','Calculators'),
		'2'=>Yii::t('yii','Games'),
		'3'=>Yii::t('yii','Fun'),
		'4'=>Yii::t('yii','Maps'),
		'5'=>Yii::t('yii','Others'),
		)); ?>
	</div>

	<div class="action">
		<?php echo Html::submitButton($model->isNewRecord ? 'Create' : 'Save',array('class'=>'submit')); ?>
	</div>

<?php echo Html::endForm(); ?>

</div><!-- form -->

<script type="text/javascript">
$("form").bind("submit", function() { return false; });

$('.submit').bind('click', function () {
  jQuery.ajax({
'type':'POST',
'url': jQuery(this).parents("form").attr("action"),
'cache':false,
'beforeSend': function(xhr) {xhr.setRequestHeader("X-Requested-With", "XMLHttpRequest")},
'data':jQuery(this).parents("form").serialize(),
'success':function(html){
jQuery("#content").html(html)}
});
  
  return false;
});

</script>

